// 连接数据库配置
const mongoose = require('mongoose');
module.exports = () => {
  mongoose
    .connect(
      `
            mongodb://${process.env.DB_USER_NAME}:${process.env.DB_PASSWORD}@${process.env.DB_HOST}:${process.env.DB_PORt}/${process.env.DB_NAME}
        `,
      {
        useCreateIndex: true,
        useFindAndModify: false,
        useUnifiedTopology: true,
        useNewUrlParser: true,
      },
    )
    .catch((err) => {
      // console.log('')
      // return Promise.reject(err)
      throw err;
    });
};
